package com.web.dao;

import com.web.entity.ReportUserInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ReportUserInfoMapper {
    @Delete({
        "delete from APP_USER_REPORT_INFO",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into APP_USER_REPORT_INFO (report_id, user_id, ",
        "type_id, type, content, ",
        "create_time, modify_time)",
        "values (#{reportId,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, ",
        "#{typeId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(ReportUserInfo record);

    int insertSelective(ReportUserInfo record);

    @Select({
        "select",
        "id, report_id, user_id, type_id, type, content, create_time, modify_time",
        "from APP_USER_REPORT_INFO",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ReportUserInfo selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(ReportUserInfo record);

    @Update({
        "update APP_USER_REPORT_INFO",
        "set report_id = #{reportId,jdbcType=INTEGER},",
          "user_id = #{userId,jdbcType=VARCHAR},",
          "type_id = #{typeId,jdbcType=VARCHAR},",
          "type = #{type,jdbcType=VARCHAR},",
          "content = #{content,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "modify_time = #{modifyTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ReportUserInfo record);
}